package io.github.talelin.latticy.controller.zty;


import io.github.talelin.core.annotation.LoginRequired;
import io.github.talelin.latticy.common.LocalUser;
import io.github.talelin.latticy.model.BookDO;
import io.github.talelin.latticy.model.UserDO;
import io.github.talelin.latticy.model.ztyDO.ShopStockDO;
import io.github.talelin.latticy.pojo.ShopStock;
import io.github.talelin.latticy.service.ShopStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZTY
 * @since 2021-04-15
 */
@RestController
@RequestMapping("/shopStock")
public class ShopStockController {

    @Autowired
    ShopStockService shopStockService;


    @GetMapping("")
    @LoginRequired
    public List<ShopStockDO> getShopStocks() {
        UserDO localUser = LocalUser.getLocalUser();
        List<ShopStockDO> shopStocks =shopStockService.selectByUserId(localUser.getId());
        shopStocks.forEach(System.out::println);
        return shopStocks;
    }


}

